package com.dz51.core.utils;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description 请求相关工具
 */
public class HttpUtil {

	public static String getClientIp(HttpServletRequest request) {
		String ip = request.getHeader("X-Forwarded-For");
		if (ip != null) {
			ip = ip.split(",")[0].trim();
		} else {
			ip = request.getRemoteAddr();
		}
		return ip;
	}
}
